package com.hkts.management.order.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hkts.management.common.utils.CustomPage;
import com.hkts.management.common.utils.Result;
import com.hkts.management.common.vo.UserOderNumVo;
import com.hkts.management.model.DTO.HktsCargoTo;
import com.hkts.management.model.DTO.PcOrderListDTO;
import com.hkts.management.model.PO.OrderAndContract;
import com.hkts.management.model.TO.AppointTo;
import com.hkts.management.model.VO.HktsOrderDetailOnPCVo;
import com.hkts.management.model.VO.PageOrderListVo;
import com.hkts.management.model.enums.OrderStatusEnum;
import com.hkts.management.model.enums.OrderTypeEnum;
import com.hkts.management.model.result.OrderResultData;
import com.hkts.management.model.result.ResultData;
import com.hkts.management.order.entity.HktsOrder;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hkts.management.order.vo.PayExportListVo;
import com.hkts.management.order.vo.PayListVo;
import com.hkts.management.order.vo.PayParamtersVo;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 服务类
 * </p>
 *
 * @author hml
 * @since 2021-04-24
 */
public interface IHktsOrderService extends IService<HktsOrder> {

    /**
     * 分页查询
     *
     * @param page
     * @param hktsOrder
     * @return
     */
    IPage<HktsOrder> selectPage(Page<HktsOrder> page, HktsOrder hktsOrder);

    List<HktsOrder> selectList(HktsOrder hktsOrder);

    List<HktsOrder> getOrderByCargoIdOnStatus(String cargoId);

    List<HktsOrder> getOrderByDriverId(String driverId);
    int selectCount(String cargoId);

    Result saveOrderByAssign(HktsCargoTo hktsCargoTo);

    Result saveOrderByAssignTo(AppointTo appoint);


    IPage<OrderResultData> getOrderByDriverIdTo(Page page, String driverId);

    /**
     * 订单列表
     * @param page
     * @param orderSubStatus
     * @return
     */
    IPage<PageOrderListVo> getOrdersPageByStatus(Page page, Integer orderSubStatus);

    /**
     * 订单详情
     * @param orderId
     * @param driverId
     * @return
     */
    ResultData getOrderDetailById(String orderId, String driverId);

    /**
     * 修改状态
     * @param orderId
     */
    void confirmReceipt(String orderId);

    /**
     * 取消订单
     * @param orderId
     */
    Result<Object> cancelOrder(String orderId);
    /**
     * 取消订单Pc
     * @param orderId
     */
    Result<Object> cancelOrderPc(String orderId,Integer isRefund,String refundDescribe);

    /**
     * 订单搜索
     * @param page
     * @param serarchInfo
     * @param time
     * @param status
     * @return
     */
    IPage searchOrder(Page page,String serarchInfo, String time, String status);

    List<Map<String, Object>> getOrderType();
    List<Map<String, Object>>  getOrderSubStatus();

    Result updateApplyStatus(String orderId,Integer status);

    Map<String,Object> getCargoDetailByOrderId(String orderId);
    void updateOrderOnEs(String id, OrderTypeEnum orderType, Integer subState);
    Result<Object> getOrderListOnPc(Page<OrderAndContract> page, PcOrderListDTO pcOrderListDTO);
    Result<HktsOrderDetailOnPCVo> getOrderDetailOnPc(String orderId);
    Result<CustomPage> getDriverTradingOnPc(Page<OrderAndContract> page,String driverId);
    Integer countOrder(String driver,Integer status);

    List<UserOderNumVo> getOderNumByUserIds(String ids);

    CustomPage<PayListVo> payPage(Page<PayListVo> page, PayParamtersVo vo);

    PayListVo getPayDetail(String orderId);

    void updatePayInfo(String orderId, String payId, float actualWeight,String actualTime);

    List<PayExportListVo> exportPayList(PayParamtersVo vo, HttpServletResponse response) throws IOException;
}